// loading 组件
import React from 'react';
import { Spin } from 'antd';
// 使用css-in-js 技术
import styled from 'styled-components';
import Pts from 'prop-types';
const Center = styled.div`
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    left: 0;
    right:0;
    top:0;
    bottom: 0;
`
const Loading = (props) => {
    return (
        <Center>
            <Spin size='large' spinning={props.spinning} tip={props.tip}></Spin>
        </Center>
    );
}

// 设置props 接收参数默认值
Loading.defaultProps = {
    tip: '加载中...',
    spinning: true
}

// 对类型进行校验
Loading.propTypes = {
    tip: Pts.string,
    spinning: Pts.bool
}


export default Loading;
